<? 
/***************************************************************************
 *   Originally by: Jpmaster77 a.k.a. The Grandmaster of C++ (GMC) - 2004
 *   Last Updated: testauction-php - 2009
 *   site : http://code.google.com/p/testauction-php
 ***************************************************************************/

/***************************************************************************
 *   This program is free software; you can redistribute it and/or modify
 *   it under the terms of the GNU Lesser General Public License as 
 *   published by the Free Software Foundation; either version 2 of the
 *   License, or (at your option) any later version. Although none of the
 *   code may be sold. If you have been sold this script, get a refund.
 ***************************************************************************/
 
class Mailer
{
   /**
    * sendWelcome - Sends a welcome message to the newly
    * registered user, also supplying the username and
    * password.
    */
   function sendWelcome($user, $email, $pass){
      global $database;
	  $array = $database->addTempUser($user, $email, time());
	  $from = "From: ".EMAIL_FROM_NAME." <".EMAIL_FROM_ADDR_REG.">";
      //$subject = "Jpmaster77's Site - Welcome!";
      $subject = WEBSITE_NAME." - Bun venit!";
	  $body = $user.",\n\n"
             ."Bun venit".$user."! Ai primit acest e-mail pentru ca" 
			 ."ai ales sa te inregistrezi pe ".WEBSITE_NAME."\r\n"
             ."Pentru a confirma inregistrarea trebuie"
			 ."sa activezi contul folosind urmatorul link:\r\n"
			 ."http://".DB_SERVER."/main.php?page=22&code=".$array[0]."&cnf=".$array[1].""
			 ."\r\n================================================\r\n"
			 ."In caz ca nu ai solicitat acest serviciu poti ignora acest"
			 ."mesaj.\r\nAcest mesaj NU necesita raspuns.";
	  ini_set('sendmail_from', EMAIL_FROM_ADDR_REG);
      return; //mail("To: ".$email, $subject, $body, $from);
   }
   
   /**
    * sendNewPass - Sends the newly generated password
    * to the user's email address that was specified at
    * sign-up.
    */
   function sendNewPass($user, $email, $pass){
      $from = "From: ".EMAIL_FROM_NAME." <".EMAIL_FROM_ADDR_REG.">";
      //$subject = "Jpmaster77's Site - Your new password";
      $subject = WEBSITE_NAME." - Noua ta parola!";
	  $body = $user.",\n\n"
             ."We've generated a new password for you at your "
             ."request, you can use this new password with your "
             ."username to log in to Jpmaster77's Site.\n\n"
             ."Username: ".$user."\n"
             ."New Password: ".$pass."\n\n"
             ."It is recommended that you change your password "
             ."to something that is easier to remember, which "
             ."can be done by going to the My Account page "
             ."after signing in.\n\n"
             ."- Jpmaster77's Site";
	  ini_set('sendmail_from', EMAIL_FROM_ADDR_REG);
      return mail("To: ".$email, $subject, $body, $from);
   }
};

/* Initialize mailer object */
$mailer = new Mailer;
?>
